/*
 * PluginOption.java
 *
 * Created on May 17, 2007, 6:04 PM
 *
 *  Copyright (C) 2010 Tal Eisenberg
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package drivechain;

/**
 * A {@link RepeatableCommandOption} that parses it's argument in the format of <name>:<properties>
 *
 * @author Tal Eisenberg
 */

import com.townleyenterprises.command.RepeatableCommandOption;
import tal.drivechain.parsing.ModuleCommandParser;

public class PluginOption extends RepeatableCommandOption {
    public PluginOption(String longName, char shortName, String argHelp, String argDesc)
    {
        super(longName,shortName,argHelp,argDesc);
    }
    
    @Override
    public void optionMatched(String arg)
    {
        //check arg is a valid class arg
        super.optionMatched(arg);
    }
    
    public String getName(int idx) {
        ModuleCommandParser comparse = new ModuleCommandParser((String)getArgs().get(idx));
        return comparse.getModuleName();
    }
    
    public String getProperties(int idx) {
        ModuleCommandParser comparse = new ModuleCommandParser((String)getArgs().get(idx));
        return comparse.getModuleProperties();
    }
}